﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

//背景移动 并出现障碍物
public class ScrollingObject : MonoBehaviour {

	private Rigidbody2D rb2d;

	void Start() {
		rb2d = GetComponent<Rigidbody2D>();
		if(GetComponent<Pillar>() != null)
			rb2d.velocity = new Vector2(GameController.initialize.backgroundSpeed, 0.0f);
	}

	void Update() {
		//小鸟飞天啦
		if (GameController.initialize.gameIsOver) {
			rb2d.velocity = Vector2.zero;
		}
	}
}
